<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%@ taglib prefix="s" uri="/struts-tags"%>

<%@ taglib prefix="odb" uri="/oracle-dashboard"%>

<h1 style='text-transform:uppercase'>Report: ${param.statistics}</h1>
<div>
	<div style='float: left'>
		<form>
			<table>
				<tr>
					<td class='field-label'>From Date:</td>
					<td><input type='text' class='date-field' id='fromDate' name='fromDate' value='${param.fromDate}' /></td>
				</tr>
				<tr>
					<td class='field-label'>To Date:</td>
					<td><input type='text' class='date-field' name='toDate'  value='${param.toDate}' /></td>
				</tr>
				<!--  
				<tr>
					<td class='field-label'>Assess health status:</td>
					<td><input type='checkbox' name='assessHealth' value='true' <c:if test="${param.assessHealth == 'true'}">checked='true'</c:if >  /></td>
				</tr>
				-->
				<tr>
					<td class='field-label'></td>
					<td><input type='submit' value='Search' />
						<input type='hidden' value='${param.statistics}' name='statistics' />
					</td>
				</tr>
			</table>
		</form>
	</div>

	<table style='margin-left:300px'>
		<tr>
			<th class='TableHeader'>Timestamp</th>
			<th class='TableHeader'>${param.statistics}</th>
			<c:if test="${param.assessHealth == 'true'}">
				<th class='TableHeader'>Health Status</th>
			</c:if>
		</tr>
		<c:forEach items="${StatisticsList}" var="item" varStatus="status">
			<tr>
				<td class='TableValue' style='padding-right: 5px;padding-left: 5px; text-align:center'><fmt:formatDate pattern='dd-MMM-yyyy hh:mm:ss' value='${item.ts}'></fmt:formatDate></td>
				<td class='TableValue' style='padding-right: 5px;padding-left: 5px; text-align:center'><fmt:formatNumber maxFractionDigits='3' value='${item.value}'></fmt:formatNumber></td>
			</tr>
		</c:forEach>
	</table>
</div>

<script>
	$(function() {
		//$(".date-field").datepicker( "option", "dateFormat",'dd/mm/yyyy' );
		$.datepicker.setDefaults ({dateFormat: 'dd/mm/yy'});
		$(".date-field").datepicker();
		
	});
</script>